<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <title>内部人员列表</title>
    <base href="<%=basePath %>"/>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="favicon.ico" >
    <link rel="Shortcut Icon" href="favicon.ico" />
    <link rel="stylesheet" type="text/css" href="assets/H-ui/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="assets/H-ui/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="assets/H-ui/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="assets/H-ui/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="assets/H-ui/static/h-ui.admin/css/style.css" />

    <link rel="stylesheet" type="text/css" href="assets/css/main.css">

</head>
<body>
<section class="Hui-article-box1">
    <div class="Hui-article">
        <article class="cl pd-20">
            <div class="text-c"> <%--日期范围：--%>
                <%--<input type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}'})" id="datemin" class="input-text Wdate" style="width:120px;">
                -
                <input type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d'})" id="datemax" class="input-text Wdate" style="width:120px;">--%>
                <form action="manageWork/showWork.action" method="post">
                    <input type="hidden" name="num" value="1">
                    <input type="text" class="input-text input-text12" placeholder="请输入姓名" name="workName" id="workName" value="${param.workName}">
                    <input type="text" class="input-text input-text12" placeholder="请输入工作编号" name="workId" id="workId" value="${param.workId}">
                    <input type="text" class="input-text input-text12" placeholder="请输入职位" name="post" id="post" value="${param.post}">
                    <select name="deskId" class="input-text input-text12">
                        <option value="0">请选择科室</option>
                        <c:if test="${not empty DeskAll22}">
                            <c:forEach items="${DeskAll22}" var="DeskAll">
                                <option value="${DeskAll.deskId}"${param.deskId==DeskAll.deskId?'selected':''}>${DeskAll.deskName}</option>
                            </c:forEach>
                        </c:if>
                    </select>
                    <select name="roleId" class="input-text input-text12">
                        <option value="0">请选择角色</option>
                        <c:if test="${not empty RoleAll22}">
                            <c:forEach items="${RoleAll22}" var="RoleAll">
                                <option value="${RoleAll.roleId}"${param.roleId==RoleAll.roleId?'selected':''}>${RoleAll.roleName}</option>
                            </c:forEach>
                        </c:if>
                    </select>

                <button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
                </form>
            </div>
            <div class="cl pd-5 bg-1 bk-gray mt-20">
                <span class="l">
			<a href="javascript:;" onclick="member_add('添加工作人员','manageWork/showAddWork.action','','510')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加工作人员</a></span> <%--<span class="r">共有数据：<strong>${pageInfo.pages}</strong> 条</span>--%> </div>
            <div class="mt-20">
                <table class="table table-border table-bordered table-hover table-bg table-sort">
                    <thead>
                    <tr class="text-c">
                        <%--<th width="25"><input type="checkbox" name="" value=""></th>--%>
                        <th width="80">工作编号</th>
                            <th width="100">所属科室</th>
                            <th width="100">所在职位</th>
                        <th width="100">姓名</th>
                        <th width="40">性别</th>
                        <th width="90">手机</th>
                        <th width="150">角色</th>
                        <%--<th width="">地址</th>--%>
                        <th width="130">加入时间</th>
                        <th width="70">状态</th>
                        <th width="100">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:if test="${not empty pageInfo.list}">
                        <c:forEach items="${pageInfo.list}" var="temp">
                            <tr class="text-c">
                                <td>${temp.workId}</td>
                                <td>${temp.desk.deskName}</td>
                                <td>${temp.post}</td>
                                <td>${temp.workName}</td>
                                <%--<td>${temp.workSex}--%>
                                <td>
                                    <c:choose>
                                        <c:when test="${temp.workSex==2}">女
                                            <%--<span class="label label-success radius">已启用</span>--%>
                                        </c:when>
                                        <c:when test="${temp.workSex==1}">男
                                            <%--<span class="label radius">已停用</span>--%>
                                        </c:when>
                                    </c:choose>
                                </td>
                                <td>${temp.mobile}</td>
                                <td>${temp.role.roleName}</td>
                                <td>${temp.registerTime}</td>
                                <td>
                                    <c:choose>
                                        <c:when test="${temp.stateId==1}">
                                            <span class="label label-success radius">已启用</span>
                                        </c:when>
                                        <c:when test="${temp.stateId==3}">
                                            <span class="label radius">已停用</span>
                                        </c:when>
                                    </c:choose>
                                </td>
                                <td class="td-manage">
                                    <c:if test="${temp.stateId==1}">
                                        <%--<a style="text-decoration:none" onClick="member_stop(this,'10001')" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>--%>
                                        <a style="text-decoration:none" onClick="changeState(${temp.workId},3)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>
                                    </c:if>
                                    <c:if test="${temp.stateId==3}">
                                        <a style="text-decoration:none" onClick="changeState(${temp.workId},1)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe615;</i></a>
                                    </c:if>
                                    <a title="编辑" href="javascript:;" onclick="member_edit('编辑','manageWork/showEeitWork.action?workId=${temp.workId}','4','','510')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                                    <a style="text-decoration:none" class="ml-5" onClick="change_password('修改密码','manageWork/showChangeWorkPwd.action?workId=${temp.workId}','10001','600','270')" href="javascript:;" title="修改密码"><i class="Hui-iconfont">&#xe63f;</i></a>
                                    <a title="删除" href="javascript:;" onclick="member_del(${temp.workId},2)" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
                                </td>
                            </tr>
                        </c:forEach>
                    </c:if>


                    <tr class="text-c">
                        <%--<td><input type="checkbox" value="1" name=""></td>--%>
                    </tr>

                    <tr class="text-c">
                        <%--<td><input type="checkbox" value="1" name=""></td>--%>
                    </tr>

                    </tbody>
                </table>
                <span class="span1">当前第${pageInfo.pageNum}页，总共${pageInfo.pages}页</span>
                <button type="button" id="lastPage" class="r button1"  onclick="pageChange(${pageInfo.nextPage})">下一页</button>
                <button type="button"  class="r button1"  onclick="pageChange(${pageInfo.prePage})">上一页</button>


            </div>
        </article>
    </div>
</section>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="assets/H-ui/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="assets/H-ui/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="assets/H-ui/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="assets/H-ui/static/h-ui.admin/js/H-ui.admin.page.js"></script>
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="assets/H-ui/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="assets/H-ui/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="assets/H-ui/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">

    //网页一加载就触发的事件
    $(function () {
        if(${pageInfo.isLastPage}){
            $("#lastPage").removeAttr("onclick");
        }
    });

    function pageChange(num){//条件查询按钮
        //console.log(num);
        var form=$("form");
        $("input[name='num']").val(num);
        form.action="manageWork/showWork.action";
        form.method="post";
        form.submit();
    }

    function changeState(id,statusid){//更改帐号状态的方法
        var isChange = window.confirm("是否更改该账户当前状态？？");
        if(isChange==true){
            window.location.href="manageWork/updataState.action?workId="+id+"&stateId="+statusid;
        }
    }

    /*用户-删除*/
    function member_del(id,statusid){
        layer.confirm('确认要删除吗？',function(index){
            layer.msg('已删除!',{icon:1,time:1000});
            window.location.href="manageWork/updataState.action?workId="+id+"&stateId="+statusid;
            // layer.msg('已删除!',{icon:1,time:1000});
        });
    }

    /*用户-添加*/
    function member_add(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*用户-编辑*/
    function member_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }

    /*密码-修改*/
    function change_password(title,url,id,w,h){
        layer_show(title,url,w,h);
    }







    /*用户-查看*/
    function member_show(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-停用*/
    function member_stop(obj,id){
        layer.confirm('确认要停用吗？',function(index){
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
            $(obj).remove();
            layer.msg('已停用!',{icon: 5,time:1000});
        });
    }

    /*用户-启用*/
    function member_start(obj,id){
        layer.confirm('确认要启用吗？',function(index){
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
            $(obj).remove();
            layer.msg('已启用!',{icon: 6,time:1000});
        });
    }




</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>